package com.dotstone.chipism.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.dotstone.chipism.R;
import com.dotstone.chipism.bean.DeviceType;
import com.dotstone.chipism.view.slidingfragmenu.BarUtils;

public class DanHuoTypeSelectActivity extends BaseActivity {

    public static TextView tvTitle;
    private View btnBack;
    public  Button danhuo_one_btn;
    public  Button danhuo_two_btn;
    public  Button danhuo_three_btn;
    public  Button btnAdd;
    private TextView mStatusBar;


    @Override
    public void widgetClick(View v) {
        Intent intent;
        switch (v.getId()) {
            case R.id.danhuo_one_btn:
                intent = new Intent(getApplicationContext(),SearchDeviceActivity2.class);
                intent.putExtra("type", DeviceType.DANHUO_SWITCH_1);
                startActivity(intent);
                finish();
                break;
            case R.id.danhuo_two_btn:
                intent = new Intent(getApplicationContext(),SearchDeviceActivity2.class);
                intent.putExtra("type", DeviceType.DANHUO_SWITCH_2);
                startActivity(intent);
                finish();
                break;
            case R.id.danhuo_three_btn:
                intent = new Intent(getApplicationContext(),SearchDeviceActivity2.class);
                intent.putExtra("type", DeviceType.DANHUO_SWITCH_3);
                startActivity(intent);
                finish();
                break;

            case R.id.back_layout:
                finish();
                break;
        }
    }



    @Override
    public void initParms(Bundle parms) {

    }

    @Override
    public View bindView() {
        return null;
    }

    @Override
    public int bindLayout() {
        return R.layout.activity_danhuo_type_select;
    }

    @Override
    public void initView(View view) {
        btnBack = $(R.id.back_layout);
        tvTitle = $(R.id.title_tv);
        btnAdd = $(R.id.nextstep);
        mStatusBar = $(R.id.tv_statusBar_mian);
        danhuo_one_btn = $(R.id.danhuo_one_btn);
        danhuo_two_btn = $(R.id.danhuo_two_btn);
        danhuo_three_btn = $(R.id.danhuo_three_btn);
        boolVersion();
    }

    @Override
    public void setListener() {
        tvTitle.setText("");
        btnAdd.setVisibility(View.GONE);
        btnBack.setOnClickListener(this);
        danhuo_one_btn.setOnClickListener(this);
        danhuo_two_btn.setOnClickListener(this);
        danhuo_three_btn.setOnClickListener(this);
    }

    @Override
    public void doBusiness(Context mContext) {

    }

    public void boolVersion() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

            Window window = getWindow();
            window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            // 透明导航栏
            // getWindow().addFlags(
            // WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            // 改变titlebar的高度
            int statusbarHeight = BarUtils.getStatusBarHeight(this);
            RelativeLayout.LayoutParams layoutParams1 = (RelativeLayout.LayoutParams) mStatusBar.getLayoutParams();
            layoutParams1.height = statusbarHeight;
            mStatusBar.setLayoutParams(layoutParams1);
            mStatusBar.setVisibility(View.VISIBLE);
        } else {
            mStatusBar.setVisibility(View.GONE);
        }
    }
}
